﻿Imports BLL
Imports DTO
Imports DAL

Public Class Program
    Dim tiecCuoi As TiecCuoi
    Dim ds_tiecCuoi As List(Of TiecCuoi)
    Dim tiecCuoi_BLL As New TiecCuoi_BLL()

    Dim sanh As Sanh
    Dim ds_sanh As List(Of Sanh)
    Dim sanh_BLL As New Sanh_BLL()

    Private Sub loadData()
        dgvdsTiecCuoi.ClearSelection()
        ds_tiecCuoi = New List(Of TiecCuoi)
        ds_tiecCuoi = tiecCuoi_BLL.LoadData()
        dgvdsTiecCuoi.DataSource = ds_tiecCuoi

        dgvdanhsachsanh.ClearSelection()
        ds_sanh = New List(Of Sanh)
        ds_sanh = sanh_BLL.LoadData()
        dgvdanhsachsanh.DataSource = ds_sanh
        cbLoaiSanh.SelectedIndex = 0
    End Sub

    Private Sub Program_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        loadData()
    End Sub


    Private Sub btnThemMonAn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThemMonAn.Click
        Dim frm As New DanhSachMonAn()
        frm.ShowDialog()
    End Sub

    Private Sub btnThemSanh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThemSanh.Click, btnTiepTuc.Click
        Try
            Dim sanh As New Sanh()
            sanh.Tên_Sảnh = txtTenSanh.Text
            sanh.Số_Bàn = Convert.ToInt32(txtSoBan.Text)
            Dim n As Integer = cbLoaiSanh.SelectedValue
            Select Case n
                Case "A"
                    sanh.Đơn_Giá_Bàn = 1000000
                Case "B"
                    sanh.Đơn_Giá_Bàn = 1100000
                Case "C"
                    sanh.Đơn_Giá_Bàn = 1200000
                Case "D"
                    sanh.Đơn_Giá_Bàn = 1400000
                Case "E"
                    sanh.Đơn_Giá_Bàn = 1600000
            End Select
            sanh_BLL.Insert(sanh)
            txtMaSanh.Text = sanh.ID.ToString()
        Catch ex As Exception

        End Try
    End Sub
End Class
